<%@ include file="/common/taglibs.jsp" %>
<security:authorize ifAnyGranted="ROLE_DEALER_USER">
    <c:if test="${loanRequest.dealerUser.username==pageContext.request.remoteUser and (loanRequest.phase=='draft' or loanRequest.phase=='dealer_submit')}">
        <c:set var="editCondition" scope="page" value="true" />
        <c:set var="editFeeRate" scope="page" value="true" />
    </c:if>
    <c:if test="${loanRequest.dealerUser.username==pageContext.request.remoteUser and loanRequest.phase=='dealer_apply_loan'}">
        <c:set var="editVehicleDetail" scope="page" value="true"/>
    </c:if>
</security:authorize>
<security:authorize ifAnyGranted="ROLE_CA,ROLE_SCA">
    <c:if test="${loanRequest.auditUser.username==pageContext.request.remoteUser and (loanRequest.phase=='ca_audit' or loanRequest.phase=='sca_audit')}">
        <c:set var="editCondition" scope="page" value="true" />
        <c:set var="editFeeRate" scope="page" value="false" />
    </c:if>
</security:authorize>

<head>
    <title><fmt:message key="loanRequestList.title"/></title>
    <meta name="menu" content="LoanRequestListMenu"/>
    <meta name="heading" content="<fmt:message key='loanRequestDetail.heading'/>"/>

</head>

<!-- Content Header (Page header) -->
<section class="content-header">
    <h1>
        <fmt:message key="loanRequestDetail.heading"/>
        <small>
            <%@include file="/WEB-INF/pages/loanRequestbasicinfo.jsp"%>
        </small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="/loanRequests"><i class="fa fa-dashboard"></i><fmt:message key="loanRequestList.heading"/></a></li>
        <li class="active"><fmt:message key="loanRequestDetail.heading"/></li>
    </ol>
</section>

<!-- Main content -->
<section class="content">
    <%@ include file="/common/messages.jsp" %>
    <form:errors path="loanRequest.*" cssClass="alert alert-danger alert-dismissable" element="div"/>

    <div class="row">
        <!-- left column -->
        <form:form commandName="loanRequest" method="post" action="loanRequestform" id="loanRequestForm">
        <form:hidden path="id" id="requestId"/>
            <form:hidden  path="number"/>
            <div class="col-md-8">
             <c:if test="${loanRequest.phase!='draft' and loanRequest.phase!='bank_credit_audit'}">
                 <%@include file="/WEB-INF/pages/loanRequestBasicForm.jsp"%>
             </c:if>
            </div>

            <%--<security:authorize ifAnyGranted="ROLE_ADMIN,ROLE_CC,ROLE_Booking">--%>
                <%--<div class="col-md-4">--%>
                    <%--<%@include file="/WEB-INF/pages/loanRequestrule.jsp"%>--%>
                    <%--<%@include file="/WEB-INF/pages/loanRequestDetailVehicleInsurence.jsp"%>--%>
                    <%--&lt;%&ndash;<%@include file="/WEB-INF/pages/loanRequestactivity.jsp"%>&ndash;%&gt;--%>
                    <%--<%@include file="/WEB-INF/pages/loanRequestfeedback.jsp"%>--%>
                    <%--<%@include file="/WEB-INF/pages/loanRequesttalkrecord.jsp"%>--%>
                <%--</div>--%>

                <%--<div class="col-md-3">--%>
                    <%--<%@include file="/WEB-INF/pages/loanRequestaction.jsp"%>--%>
                    <%--<%@include file="/WEB-INF/pages/loanRequestbooking.jsp"%>--%>
                <%--</div>--%>
            <%--</security:authorize>--%>

            <security:authorize ifAnyGranted="ROLE_DEALER_USER,ROLE_Bank_CREDIT,ROLE_Bank_USER,ROLE_M_RECEIVE,ROLE_Bond_USER,ROLE_Insurance,ROLE_CC,ROLE_CA,ROLE_SCA">
                <div class="col-md-4">

                    <c:if test="${loanRequest.status=='loan_audit' or loanRequest.status=='dealer_apply_loan'}">
                        <%@include file="/WEB-INF/pages/loanRequestDetailVehicleInsurence.jsp"%>
                    </c:if>

                    <security:authorize ifAnyGranted="ROLE_DEALER_USER">
                    <c:if test="${loanRequest.phase=='dealer_apply_loan'}">
                        <%@include file="/WEB-INF/pages/loanRequestLoanMoneyList.jsp"%>
                    </c:if>
                    </security:authorize>

                    <%--<%@include file="/WEB-INF/pages/loanRequestaction.jsp"%>--%>
                    <c:choose>
                        <c:when test="${param.mode == 'edit'}">
                            <%@include file="/WEB-INF/pages/loanRequestformaction.jsp"%>
                        </c:when>
                        <c:otherwise>
                            <%@include file="/WEB-INF/pages/loanrequestactionRender.jsp"%>
                        </c:otherwise>
                    </c:choose>

                    <c:if test="${viewInfo.feedbackVisible}">
                        <%@include file="/WEB-INF/pages/loanRequestfeedback.jsp"%>
                    </c:if>
                    <c:if test="${viewInfo.talkRecordVisible}">
                        <%@include file="/WEB-INF/pages/loanRequesttalkrecord.jsp"%>
                    </c:if>
                    <security:authorize ifNotGranted="ROLE_DEALER_USER,ROLE_DEALER_ADMIN">
                        <%@include file="/WEB-INF/pages/loanRequestactivity.jsp"%>
                    </security:authorize>
                </div>
            </security:authorize>
    </div>

    </form:form>
</section>

<div id="dialog"></div>
<c:set var="scripts" scope="request">
<%@include file="commonJs.jsp"%>
    <script type='text/javascript' src="<c:url value='/dwr/engine.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/util.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/ProvinceManager.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/CityManager.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/VehicleBrandManager.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/VehicleSeriesManager.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/VehicleModelManager.js'/>"></script>
    <script type='text/javascript' src="<c:url value='/dwr/interface/LoanProductManager.js'/>"></script>
    <script type="text/javascript" src="<c:url value="/scripts/scoreconf.js"/>"></script>
    <script type="text/javascript" src="<c:url value='/scripts/loanRequestForm.js'/>"></script>
</c:set>